﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="hunter.aspx.cs" Inherits="wanted" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <h2>商品獵人</h2>
    <div style="border-style: solid; border-color: inherit; border-width: 1px;
        height: 456px; top: 0px; left: 0px;position:relative;">
        <div style="width: 100%; height: 30px; position: absolute; top: 0px; left: 0px; vertical-align: middle; text-align: center; line-height: normal;">
            
            <asp:DropDownList ID="ddlSC" runat="server">
                <asp:ListItem>關鍵字</asp:ListItem>
            </asp:DropDownList>
            &nbsp;<asp:TextBox ID="tbSearch" runat="server"></asp:TextBox>
            &nbsp;<asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" Text="搜尋" />
            &nbsp;<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="WantedList.aspx">進階搜尋</asp:HyperLink>
        </div>
        <div style="position: relative;top:30px;">
            <div style="width: 50%; height: 100%; position: absolute; left: 0px;">
                &gt;&gt;最新五筆通緝令<br />
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:projectConnectionString %>"
                    SelectCommand="SELECT WGBrand, WGName, WGBudget, WId FROM Wanted WHERE (WVisible = 1) AND (WStart &lt; { fn NOW() }) AND (WEnd &gt; { fn NOW() }) ORDER BY WStart DESC">
                </asp:SqlDataSource>
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="WId"
                    DataSourceID="SqlDataSource1" PageSize="5" CellPadding="4" ForeColor="#333333"
                    GridLines="None" AllowPaging="True">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:BoundField DataField="WGBrand" HeaderText="製造商" SortExpression="WGBrand" />
                        <asp:BoundField DataField="WGName" HeaderText="商品名稱" SortExpression="WGName" />
                        <asp:BoundField DataField="WGBudget" HeaderText="預算" SortExpression="WGBudget" />
                        <asp:HyperLinkField DataNavigateUrlFields="Wid" DataNavigateUrlFormatString="wDetail.aspx?id={0}"
                            HeaderText="詳細內容" Text="查看" />
                    </Columns>
                    <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                    <SortedAscendingCellStyle BackColor="#FDF5AC" />
                    <SortedAscendingHeaderStyle BackColor="#4D0000" />
                    <SortedDescendingCellStyle BackColor="#FCF6C0" />
                    <SortedDescendingHeaderStyle BackColor="#820000" />
                </asp:GridView>
            </div>
            <div style="width: 50%; height: 100%; border-left: 1px solid; position: absolute;
                right: 0px;">
                &gt;&gt;TOP 5 熱門通緝令<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:projectConnectionString %>"
                    SelectCommand="SELECT derivedtbl_1.WId, Wanted_1.WGMadeIn, Wanted_1.WGBrand, Wanted_1.WGName, derivedtbl_1.popular FROM (SELECT Wanted.WId, COUNT(Negotiation.NId) AS popular FROM Negotiation LEFT OUTER JOIN Member ON Negotiation.MId = Member.MId LEFT OUTER JOIN Wanted ON Negotiation.WId = Wanted.WId WHERE (Negotiation.NVisible = 1) AND (Wanted.WVisible = 1) AND (Member.MVisible = 1) AND (Wanted.WStart &lt; { fn NOW() }) AND (Wanted.WEnd &gt; { fn NOW() }) GROUP BY Wanted.WId) AS derivedtbl_1 LEFT OUTER JOIN Wanted AS Wanted_1 ON derivedtbl_1.WId = Wanted_1.WId ORDER BY derivedtbl_1.popular DESC">
                </asp:SqlDataSource>
                <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" CellPadding="4"
                    DataSourceID="SqlDataSource2" ForeColor="#333333" GridLines="None" PageSize="5"
                    AllowPaging="True">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:BoundField DataField="WGMadeIn" HeaderText="產地" SortExpression="WGMadeIn" />
                        <asp:BoundField DataField="WGBrand" HeaderText="製造商" SortExpression="WGBrand" />
                        <asp:BoundField DataField="WGName" HeaderText="商品名稱" SortExpression="WGName" />
                        <asp:BoundField DataField="popular" HeaderText="熱度" ReadOnly="True" SortExpression="popular" />
                        <asp:HyperLinkField DataNavigateUrlFields="Wid" DataNavigateUrlFormatString="wDetail.aspx?id={0}"
                            HeaderText="詳細內容" Text="查看" />
                    </Columns>
                    <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                    <SortedAscendingCellStyle BackColor="#FDF5AC" />
                    <SortedAscendingHeaderStyle BackColor="#4D0000" />
                    <SortedDescendingCellStyle BackColor="#FCF6C0" />
                    <SortedDescendingHeaderStyle BackColor="#820000" />
                </asp:GridView>
            </div>
        </div>
    </div>
</asp:Content>
